<template>
  <div class="yongjinzhichu">
    <div class="kflexbc">
      <div class="kflexc" style="margin-bottom: 20px;">
        <div class="lia" :class="all.status == '20,40,50'?'acts':''" @click="search('20,40,50')">待打款</div>
        <div class="lia" :class="all.status == 25?'acts':''" @click="search(25)">已驳回</div>
        <div class="lia" :class="all.status == 30?'acts':''" @click="search(30)">已打款</div>
      </div>
      <!-- <div class="kflexc">
        <el-button type="primary" round  style="margin-right: 20px;" @click="goid('/yongjinzhichu/zhichudakuan/fapiao')">发票信息配置</el-button>
        <el-button type="primary" round  style="margin-right: 20px;" @click="goid('/yongjindakuan/yongjindakuan')">支付账户配置</el-button>
      </div> -->
    </div>

    <div class="kflexc" style="margin-bottom: 20px;">
      <el-select clearable v-model="all.merchant_name"  style="width: 220px; margin-right: 20px;" filterable placeholder="选择分销商">
        <el-option :label="item.name" :value="item.child_shop_id"  v-for="item in fenxiaoshanglists" :key="item.child_shop_id" ></el-option>
      </el-select>

      <el-input v-model="all.withdrawal_name" style="width: 320px; margin-right: 30px;" placeholder="请输入提现账户"></el-input>

      <!-- <el-select clearable v-model="all.invoice_type"  style="width: 220px; margin-right: 20px;" filterable placeholder="是否开票">
        <el-option label="增值税专用发票(0.06)" value="1"></el-option>
        <el-option label="增值税专用发票(0.03)" value="2"></el-option>
        <el-option label="增值税专用发票(0.01)" value="3"></el-option>
        <el-option label="增值税普通发票" value="4"></el-option>
        <el-option label="无发票" value="5"></el-option>
      </el-select> -->

      <el-select clearable v-model="all.have_invoice"  style="width: 220px; margin-right: 20px;" filterable placeholder="是否开票">
        <el-option label="有发票" value="1"></el-option>
        <el-option label="无发票" value="0"></el-option>
      </el-select>


      <el-select  v-model="all.cm_name" style="width: 220px; margin-right: 20px;" placeholder="选择客户经理" filterable clearable>
        <el-option :label="item.name" :value="item.id"  v-for="item in kehujinglilists" :key="item.id" ></el-option>
      </el-select>

      <div style="font-size: 12px; margin-right: 10px;">提现申请时间</div>
      <div style="margin-right: 20px;">
        <el-date-picker  v-model="times2" @change="timeschange2" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" :default-time="['00:00:00', '23:59:59']" range-separator="至"  start-placeholder="开始日期"  end-placeholder="结束日期"></el-date-picker>
      </div>
    </div>
    <div class="kflexc" style="margin-bottom: 20px;">
      <div style="font-size: 12px; margin-right: 10px;" v-if="all.status == 30">打款时间</div>
      <div style="margin-right: 20px;" v-if="all.status == 30">
        <el-date-picker  v-model="times" @change="timeschange" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" :default-time="['00:00:00', '23:59:59']" range-separator="至"  start-placeholder="开始日期"  end-placeholder="结束日期"></el-date-picker>
      </div>
      <el-button type="danger" round  style="margin-right: 20px;" @click="search()">检索</el-button>
      <!-- <el-button type="primary" round  style="margin-right: 20px;" @click="goid('/yongjinzhichu/zhichudakuan/fapiao')">发票信息配置</el-button> -->

      <el-button type="danger" round  style="margin-right: 20px;" @click="daochu()">导出明细</el-button>

      <el-button type="danger" round  style="margin-right: 20px;" @click="daochu2()">批量下载发票</el-button>
    </div>

    <el-table :data="list" show-summary border style="width: 100%; margin: 20px 0;">

      <el-table-column align='center' prop='id' label="提现ID"></el-table-column>
      <el-table-column align='center' prop='merchant_name' label="申请提现人"></el-table-column>
      <el-table-column align='center' prop='withdrawal_name' label="提现账户名">
        <template slot-scope="scope">
          <div v-if="scope.row.collect_type == 1">{{scope.row.bank_name}}</div>
          <div v-if="scope.row.collect_type == 2">{{scope.row.ali_name}}</div>
        </template>
      </el-table-column>

      <el-table-column align='center' prop='apply_withdraw_at' label="提现申请时间"></el-table-column>
      <el-table-column align='center' prop='orders_count' label="提现订单数量"></el-table-column>
      <el-table-column align='center' prop='final_commission' label="提现金额"></el-table-column>
      <el-table-column align='center' width="300px" prop='invoice_info' label="票据类型">
        <template slot-scope="scope">
          <div class="kflexcc">
            {{scope.row.invoice_info}}
            <div style="color: #409EFF; cursor: pointer; margin-left: 10px;" @click="piaojushow(scope.row)">查看</div>
          </div>
        </template>
      </el-table-column>
      <el-table-column align='center' prop='invoice_header' label="支付公司"></el-table-column>
      <el-table-column align='center' prop='tax_amount' label="扣除税点金额"></el-table-column>
      <el-table-column align='center' prop='withdraw_amount' label="最终支出金额">
        <!-- <template slot-scope="scope">
        {{scope.row.final_commission - scope.row.tax_amount}}
        </template> -->
      </el-table-column>
      <el-table-column align='center' prop='status_name'  label="打款状态">
        <template slot-scope="scope">
          <div v-if="scope.row.status == 0">未结算</div>
          <div v-if="scope.row.status == 10">待结算</div>
          <div v-if="scope.row.status == 20">待打款</div>
          <div v-if="scope.row.status == 25" style="color: #f00;">
             已驳回
             <el-tooltip class="item" effect="dark" :content="scope.row.refuse_reason" placement="top-start">
               <i class="el-icon-warning" style="color: #f00; font-size: 22px;"></i>
             </el-tooltip>
          </div>
          <div v-if="scope.row.status == 30" style="color: green;">已打款</div>
          <div v-if="scope.row.status == 40" style="color: #f00;">
             打款失败
             <el-tooltip class="item" effect="dark" :content="scope.row.refuse_reason" placement="top-start">
               <i class="el-icon-warning" style="color: #f00; font-size: 22px;"></i>
             </el-tooltip>
          </div>
          <div v-if="scope.row.status == 50">打款中</div>
        </template>
      </el-table-column>
      <el-table-column align='center' prop='withdraw_at' label="打款时间">
        <template slot-scope="scope">
          <div v-if="scope.row.status == 30">{{scope.row.withdraw_at}}</div>
        </template>
      </el-table-column>
      <el-table-column align='center' width="200px" label="操作">
        <template slot-scope="scope">
          <div class="kflexcc" v-if="checkquanxian('V020301').length > 0">
            <div style="color: #409EFF; margin: 10px; cursor: pointer;" v-if="scope.row.status == 20 || scope.row.status == 40" @click="luru(scope.row,1)">

              <el-tooltip class="item" effect="dark" content="本记录中包含粗放结算方式订单，请仔细核实金额" placement="top-start" v-if="scope.row.is_cf == 1 && all.status == '20,40,50'">
                <img src="https://photo.91haoka.cn/jingtanhao.png" style="cursor: pointer; margin-right: 5px; position: relative; top: 5px; ">
              </el-tooltip>
              打款
            </div>
            <div style="color: #409EFF; margin: 10px; cursor: pointer;" v-if="scope.row.status == 20 || scope.row.status == 40" @click="bohui(scope.row)">驳回</div>

            <div style="color: #409EFF; margin: 10px; cursor: pointer;" v-if="scope.row.status == 30" @click="luru(scope.row,2)">查看详情</div>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination style="text-align: right;" background layout="total,prev, pager, next" :current-page="all.page" @current-change="fanye" :page-size="all.page_size" :total="total"></el-pagination>

    <el-dialog :title="tixianren" :visible.sync="log2" width="800px" :close-on-click-modal="false" :close-on-press-escape="false">
      <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;">提现金额</div>
      <div style="background: rgb(255, 245, 245);border-radius: 10px; padding: 20px; justify-content: space-around; margin-bottom: 20px;" class="kflexc" >
        <div style="text-align: center;">
          <div style="color:rgb(64, 66, 71); font-size: 16px; margin-bottom: 10px;">提现金额</div>
          <div style="color:rgb(254, 61, 61); font-size: 16px; font-weight: bold;">￥{{all2.final_commission}}</div>
        </div>

        <div style="text-align: center;">
          <div style="color:rgb(64, 66, 71); font-size: 16px; margin-bottom: 10px;">增值税税额</div>
          <div style="color:rgb(254, 61, 61); font-size: 16px; font-weight: bold;">￥{{all2.tax_amount}}</div>
        </div>
        <div style="text-align: center;">
          <div style="color:rgb(64, 66, 71); font-size: 16px; margin-bottom: 10px;">实际到账金额</div>
          <div style="color:rgb(254, 61, 61); font-size: 16px; font-weight: bold;">￥{{all2.withdraw_amount}}</div>
        </div>
      </div>
      <div style="font-size: 18px; margin-bottom: 20px; font-size: 14px;">开票类型：
        <span style="color: #409EFF; cursor: pointer;" @click="piaojushow(all2)">{{all2.invoice_info}}</span>
       </div>

      <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;" v-if="all2.collect_type == 1">收款账户</div>
      <div style="margin-bottom: 20px;" v-if="all2.collect_type == 1">

        <div class="kflex" style="margin-bottom: 20px;">
          <div style="width: 220px;">卡号：{{all2.bank_no}}</div>
          <div style="width: 220px;">开户人：{{all2.bank_name}}</div>
          <div style="width: 220px;">身份证号：{{all2.bank_idcard}}</div>
        </div>
        <div class="kflex">
          <div style="width: 220px;">开户行：{{all2.bank}}</div>
          <div style="width: 220px;">开户支行行：{{all2.bank_sub}}</div>
        </div>
      </div>
      <div style="margin-bottom: 20px;" v-if="all2.collect_type == 2">
        <div class="kflex" style="margin-bottom: 20px;">
          <div style="width: 220px;">支付宝号：{{all2.ali_no}}</div>
          <div style="width: 220px;">姓名：{{all2.ali_name}}</div>
          <div style="width: 220px;">身份证号：{{all2.ali_idcard}}</div>
        </div>
      </div>

      <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;" >支付信息</div>
      <!-- 打款 -->
      <div v-if="lurutype == 1">

        <div class="kflex" style="margin-bottom: 20px;">
          <div class="dkfs" @click="collect_type = 4" :class="collect_type == 4 ?'dkfsact':''" v-if="gongmao.show">工猫</div>
          <div class="dkfs" @click="collect_type = 1" :class="collect_type == 1 ?'dkfsact':''">线下打款</div>
          <div class="dkfs" @click="collect_type = 3" :class="collect_type == 3 ?'dkfsact':''" v-if="zhifubao.show">支付宝</div>
          <div class="dkfs" @click="collect_type = 5" :class="collect_type == 5 ?'dkfsact':''" v-if="yunzhanghu.show">云账户</div>
        </div>

        <div v-if="collect_type == 1">
          <div class="kflexc" style="margin-bottom: 20px;">
            支付备注：<el-input v-model="all2.withdraw_remark" style="width: 320px; margin-right: 30px;" placeholder="请输入"></el-input>
          </div>

          <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;">上传打款截图</div>
          <!-- <div v-if="!all2.withdraw_pic" class="kflexcc" style="width: 100%; height: 220px; background: rgb(246, 248, 251);" >
            Ctrl+V直接粘贴截图
          </div> -->
          <!-- <div v-if="all2.withdraw_pic" class="kflexcc" style="width: 100%; background: rgb(246, 248, 251);">
            <img :src="all2.withdraw_pic" style="max-width: 100%;">
          </div> -->
          <div v-for="(item,index) in all2.withdraw_pics" :key="index" @click="dangqian = index" style="border: 2px #fff solid;" :class="dangqian == index?'tuact':''">

            <div v-if="!item" class="kflexcc" style="width: 100%; height: 220px; background: rgb(246, 248, 251);" >
              先选中此处，然后Ctrl+V直接粘贴截图
            </div>

            <img v-if="item" :src="item" style="max-width: 100%;">
          </div>
          <div @click="tianjiajietu" style="margin-top: 20px; color: #409EFF; cursor: pointer;">
            添加截图
          </div>
        </div>

        <div v-if="collect_type == 3">
          <div class="kflexc" style="margin-bottom: 20px;">
            支付宝账户余额：{{zhifubao.yue}}元
            <span style="color: rgb(1, 200, 63); margin-left: 20px;" v-if="zhifubao.yue >= all2.withdraw_amount">充足</span>
            <span style="color: rgb(205, 0, 0); margin-left: 20px;" v-if="zhifubao.yue < all2.withdraw_amount">不足</span>
          </div>
          <div class="kflexc" style="margin-bottom: 20px;">
            支付备注：<el-input v-model="all2.withdraw_remark" style="width: 320px; margin-right: 30px;" placeholder="请输入"></el-input>
          </div>
          <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;">上传打款截图</div>
          <!-- <div v-if="!all2.withdraw_pic" class="kflexcc" style="width: 100%; height: 220px; background: rgb(246, 248, 251);" >
            Ctrl+V直接粘贴截图
          </div> -->
          <!-- <div v-if="all2.withdraw_pic" class="kflexcc" style="width: 100%; background: rgb(246, 248, 251);">
            <img :src="all2.withdraw_pic" style="max-width: 100%;">
          </div> -->
          <div v-for="(item,index) in all2.withdraw_pics" :key="index" @click="dangqian = index" style="border: 2px #fff solid;" :class="dangqian == index?'tuact':''">

            <div v-if="!item" class="kflexcc" style="width: 100%; height: 220px; background: rgb(246, 248, 251);" >
              先选中此处，然后Ctrl+V直接粘贴截图
            </div>

            <img v-if="item" :src="item" style="max-width: 100%;">
          </div>
          <div @click="tianjiajietu" style="margin-top: 20px; color: #409EFF; cursor: pointer;">
            添加截图
          </div>
        </div>

        <div v-if="collect_type == 4">
          <div class="kflexc" style="margin-bottom: 20px;">
            工猫账户余额：{{gongmao.yue}}元
            <span style="color: rgb(1, 200, 63); margin-left: 20px;" v-if="gongmao.yue >= all2.withdraw_amount">充足</span>
            <span style="color: rgb(205, 0, 0); margin-left: 20px;" v-if="gongmao.yue < all2.withdraw_amount">不足</span>
          </div>
          <div class="kflexc" style="margin-bottom: 20px;">
            支付备注：<el-input v-model="all2.withdraw_remark" style="width: 320px; margin-right: 30px;" placeholder="请输入"></el-input>
          </div>
          <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;">上传打款截图</div>
          <!-- <div v-if="!all2.withdraw_pic" class="kflexcc" style="width: 100%; height: 220px; background: rgb(246, 248, 251);" >
            Ctrl+V直接粘贴截图
          </div> -->
          <!-- <div v-if="all2.withdraw_pic" class="kflexcc" style="width: 100%; background: rgb(246, 248, 251);">
            <img :src="all2.withdraw_pic" style="max-width: 100%;">
          </div> -->
          <div v-for="(item,index) in all2.withdraw_pics" :key="index" @click="dangqian = index" style="border: 2px #fff solid;" :class="dangqian == index?'tuact':''">

            <div v-if="!item" class="kflexcc" style="width: 100%; height: 220px; background: rgb(246, 248, 251);" >
              先选中此处，然后Ctrl+V直接粘贴截图
            </div>

            <img v-if="item" :src="item" style="max-width: 100%;">
          </div>
          <div @click="tianjiajietu" style="margin-top: 20px; color: #409EFF; cursor: pointer;">
            添加截图
          </div>
        </div>

        <div v-if="collect_type == 5">
          <div class="kflexc">
            <div @click="huoquyue(item)" :class="dealer_id == item.dealer_id?'actss':''" v-if="item.status == 1" v-for="item in yunzhanghulist" :key="item.id"  style="background: rgb(255, 255, 255); min-width: 80px; margin-bottom: 20px; border: 1px #E5E5E5 solid; padding: 30px; height: 50px; line-height: 25px; border-radius: 10px; margin-right: 30px; cursor: pointer;  color: rgb(102, 102, 102);">
              <div >{{ item.dealer_id }}</div>
              <div >{{ item.name }}</div>
            </div>
          </div>


          <div class="kflexc" style="margin-bottom: 20px;">
            云账户账户余额：{{yunzhanghu.yue}}元
            <span style="color: rgb(1, 200, 63); margin-left: 20px;" v-if="yunzhanghu.yue >= all2.withdraw_amount*1">充足</span>
            <span style="color: rgb(205, 0, 0); margin-left: 20px;" v-if="yunzhanghu.yue < all2.withdraw_amount*1">不足</span>
          </div>
          <div class="kflexc" style="margin-bottom: 20px;">
            支付备注：<el-input v-model="all2.withdraw_remark" style="width: 320px; margin-right: 30px;" placeholder="请输入"></el-input>
          </div>
          <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;">上传打款截图</div>
          <!-- <div v-if="!all2.withdraw_pic" class="kflexcc" style="width: 100%; height: 220px; background: rgb(246, 248, 251);" >
            Ctrl+V直接粘贴截图
          </div> -->
          <!-- <div v-if="all2.withdraw_pic" class="kflexcc" style="width: 100%; background: rgb(246, 248, 251);">
            <img :src="all2.withdraw_pic" style="max-width: 100%;">
          </div> -->
          <div v-for="(item,index) in all2.withdraw_pics" :key="index" @click="dangqian = index" style="border: 2px #fff solid;" :class="dangqian == index?'tuact':''">

            <div v-if="!item" class="kflexcc" style="width: 100%; height: 220px; background: rgb(246, 248, 251);" >
              先选中此处，然后Ctrl+V直接粘贴截图
            </div>

            <img v-if="item" :src="item" style="max-width: 100%;">
          </div>
          <div @click="tianjiajietu" style="margin-top: 20px; color: #409EFF; cursor: pointer;">
            添加截图
          </div>
        </div>

<!--        <div v-if="collect_type == 3">
          <div style="margin-bottom: 20px;">
            <div class="kflex" style="margin-bottom: 20px;">
              <div style="width: 220px;">支付宝号：{{all2.ali_no}}</div>
              <div style="width: 220px;">姓名：{{all2.ali_name}}</div>
              <div style="width: 220px;">身份证号：{{all2.ali_idcard}}</div>
            </div>
          </div>

          <div class="kflexc">
            支付备注：<el-input v-model="all2.withdraw_remark" style="width: 320px; margin-right: 30px;" placeholder="请输入"></el-input>
          </div>
          <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;">上传打款截图</div>
          <div v-if="!all2.withdraw_pic" class="kflexcc" style="width: 100%; height: 220px; background: rgb(246, 248, 251);" >
            Ctrl+V直接粘贴截图
          </div>
          <div v-if="all2.withdraw_pic" class="kflexcc" style="width: 100%; background: rgb(246, 248, 251);">
            <img :src="all2.withdraw_pic" style="max-width: 100%;">
          </div>

        </div> -->
      </div>




      <!-- 查看打款 -->
      <div v-if="lurutype==2">
        <!-- 线下 -->

          <!-- <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;" >打款信息</div>
          <div style="margin-bottom: 20px;" >
            <div  style="margin-bottom: 20px;">
              <div style="width: 220px;margin-bottom: 20px;font-weight: bold;">
                <span>{{ all2.withdraw_at }}</span>，
                <span v-if="all2.status==10">已打款</span>
                <span v-if="all2.status==0">待打款</span>
                <span v-if="all2.status==1">打款失败</span>
                <span v-if="all2.status==2">打款中</span>
              </div>
              <div style="width: 220px;">

                <span style=" margin-right: 20px; font-weight: bold;">打款方式</span>
                <span v-if="all2.pay_way==0&&all2.status != 0">未知</span>
                <span v-if="all2.pay_way==0&&all2.status == 0">-</span>
                <span v-if="all2.pay_way==1">线下</span>
                <span v-if="all2.pay_way==2">云账户</span>
                <span v-if="all2.pay_way==3">支付宝</span>
              </div>
              <div v-if="all2.pay_way==2" style="width: 220px;margin-bottom: 20px;margin-top: 20px;">打款订单ID：{{all2.payment_txn}}</div>
            </div>
          </div> -->


          <div class="kflex">
            <div style=" margin-right: 20px; font-weight: bold;">支付方式</div>
            <div>
              <div style="color:rgb(0, 72, 250); margin-bottom: 20px;">
                {{all2.pay_way_name}}
              </div>
              <div style="color:rgb(166, 166, 166); margin-bottom: 20px;">支付金额：{{all2.withdraw_amount}}元 </div>
              <div style="color:rgb(166, 166, 166); margin-bottom: 20px;">支付时间：{{all2.withdraw_at}}</div>
              <div style="color:rgb(166, 166, 166); margin-bottom: 20px;">支付订单号：{{all2.payment_txn}}</div>
            </div>
          </div>
          <div class="kflex" style="margin-bottom: 20px;">
            <div style=" margin-right: 20px; font-weight: bold;">支付备注</div>
            <div>
              <div>{{all2.withdraw_remark}}</div>
            </div>
          </div>
          <div class="kflex"  style="margin-bottom: 20px;">
            <div style=" margin-right: 20px; font-weight: bold;">支付截图</div>
            <div>
              <!-- <div><img :src="all2.withdraw_pic" style="max-width: 100%;"></div> -->
              <div v-for="(item,index) in all2.withdraw_pics" :key="index" @click="dangqian = index">
                <img v-if="item" :src="item" style="max-width: 100%;">
              </div>
            </div>
          </div>


      </div>

      <span slot="footer" class="dialog-footer">
        <el-button round @click="log2 = false">关闭</el-button>
        <el-button round type="primary" @click="quedingdakuan" v-if="all.status != 30">打款完成</el-button>
      </span>
    </el-dialog>

    <el-dialog title="查看发票" :visible.sync="log6" width="820px" :close-on-click-modal="false" :close-on-press-escape="false">
      <div v-if="log6fapiao.invoice_way == 2" style="margin-bottom: 20px;">
        物流公司：{{log6fapiao.track_company}}
      </div>
      <div v-if="log6fapiao.invoice_way == 2">
        物流单号：{{log6fapiao.track_no}}
      </div>
      <div v-if="log6fapiao.invoice_way == 1">

        <a :href="item" target="_blank" style="color: rgb(0, 90, 255); display: block; margin-bottom: 10px;" v-for="(item,index) in log6fapiao.invoice_imgs">{{item}}</a>
      </div>
      <!-- <div v-if="log6fapiao.invoice_way == 1" class="flexcc" style="margin: 20px 0;"><el-button round plain type="primary" @click="down(log6fapiao.invoice_img)">下载</el-button></div> -->

      <span slot="footer" class="dialog-footer">
        <el-button round @click="log6 = false">关闭</el-button>
      </span>
    </el-dialog>

    <el-dialog title="驳回原因" :visible.sync="bohuilog" width="400px" :close-on-click-modal="false" :close-on-press-escape="false">
      <el-input v-model="bohuiall.refuse_reason"  placeholder="请输入驳回原因" ></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button round @click="bohuilog = false">关闭</el-button>
        <el-button round type="primary" @click="bohuigo">确定驳回</el-button>
      </span>
    </el-dialog>



    <!-- 云账户打款弹窗 -->
    <!-- <el-dialog
      title="云账户打款"
      :visible.sync="isshowyzhpay"
      :close-on-click-modal="false"
      width="400px">
      <div style="text-align: center;font-size: 16px;">
        <div style="margin-bottom:30px">您将使用云账户支付：￥{{ iscanpayinfo.withdraw_amount }}</div>
        <div style="font-weight: bold;">
          云账户余额：{{ iscanpayinfo.total_balance }}元
          <span v-if="iscanpayinfo.total_balance*1>=iscanpayinfo.withdraw_amount*1" style="margin-left: 10px;color: #67C23A;">充足</span>
          <span v-else style="margin-left: 10px;color: #EEF7FF;">不足</span>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button round @click="isshowyzhpay = false">取 消</el-button>
        <el-button :disabled="iscanpayinfo.total_balance*1<iscanpayinfo.withdraw_amount*1" round type="primary" @click="surepay">确 定</el-button>
      </span>
    </el-dialog> -->

    <!-- 支付宝打款弹窗 -->
    <!-- <el-dialog
      title="支付宝打款"
      :visible.sync="isshowyzhpay2"
      :close-on-click-modal="false"
      width="400px">
      <div style="text-align: center;font-size: 16px;">
        <div style="margin-bottom:30px">您将使用支付宝支付：￥{{ rowinfo.withdraw_amount }}</div>
        <div style="font-weight: bold;">
          支付宝余额：{{ iscanpayinfo2.available_amount }}元
          <span v-if="iscanpayinfo2.available_amount*1 >= rowinfo.withdraw_amount*1" style="margin-left: 10px;color: #67C23A;">充足</span>
          <span v-else style="margin-left: 10px;color: #EEF7FF;">不足</span>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button round @click="isshowyzhpay2 = false">取 消</el-button>
        <el-button :disabled="iscanpayinfo2.available_amount*1 < rowinfo.withdraw_amount*1 " round type="primary" @click="surepay2">确 定</el-button>
      </span>
    </el-dialog> -->

  </div>
</template>

<script>
  import axios from 'axios'
  import top from '@/components/top.vue'
  import left from '@/components/left.vue'
  import foot from '@/components/foot.vue'
  import moment from "moment";
  import XLSX from 'xlsx';
  import {
      read,utils
    } from 'xlsx'

  export default {
    components: {
      "left": left,
      "top": top,
      "foot": foot
    },
    name: "yongjinzhichu",
    data() {
      return {
        bohuilog:false,
        bohuiall:{
          id:"",
          refuse_reason:""
        },
        loading:false,
        list:"",
        all:{
          end:"",
          start:"",
          page:1,
          page_size:20,
          merchant_name:"",
          status:'20,40,50',
          apply_withdraw_at_start:"",
          apply_withdraw_at_end:"",
          confirm_expend_at_start:"",
          confirm_expend_at_end:"",
          cm_name:"",
          invoice_type:"",
          have_invoice:"",
          withdrawal_name:"",
          withdraw_at_start:"",
          withdraw_at_end:""
        },
        total:0,
        fenxiaoshanglists:"",

        log:false,
        log2:false,

        list:[],
        total:0,

        widthss:false,
        fapiaoall:{
          configs:""
        },
        fapiaojson:[],
        all2:{
          final_commission:"",
          tax_amount:"",
          withdraw_amount:"",
          invoice_info:"",
          bank_no:"",
          bank_name:"",
          bank_idcard:"",
          bank:"",
          bank_sub:"",
          ali_no:"",
          ali_name:"",
          ali_idcard:"",
          withdraw_remark:"",
          withdraw_pic:"",
          withdraw_pics:['']
        },
        times:[],
        times2:[],
        log6:false,
        log6fapiao:"",
        tixianren:"提现人",
        isshowyzhpay:false,
        isshowyzhpay2:false,
        rowinfo:'',
        nowmoneyobj:{},
        iscanpayinfo:{},
        iscanpayinfo2:{},
        shoujiban:false,
        loading: false,
        finished: false,
        lurutype:'',
        showdate:false,
        whodata:"",
        minDate: new Date(2023, 0, 1),
        areaList:"",
        show:false,
        ksradio:'',
        zhibaofuyue:0,
        zhifubaom:false,
        kehujinglilists:"",
        collect_type:1,
        gongmaoyue:0,
        gongmao:{
          show:false
        },
        peizhi:"",

        zhifubao:{
          yue:0,
          show:false
        },
        yunzhanghu:{
          yue:0,
          show:false
        },
        yunzhanghulist:[],
        dealer_id:"",
        dangqian:0
      }
    },
    created() {
      this.getlist()
      //获取支付宝开
      axios.get('/api/plan-market/ali/safe/config/get')
        .then(response => {
          if (response.data.msg.code == 0) {
            if(response.data.data.is_accountbook){
              this.zhifubao.show = true

              axios.get('/api/plan-market/ali/safe/user/account/query')
                .then(response2 => {
                  if (response2.data.msg.code == 0) {
                    this.zhifubao.yue = response2.data.data.available_amount
                  } else {
                    this.$message.error(response2.data.msg.info);
                  }
                })
            }


          } else {
            this.$message.error(response.data.msg.info);
          }
        })

      //获取云账户开
      axios.get('/api/plan-market/yunzhifu/getYunConfig')
        .then(response => {
          if (response.data.msg.code == 0) {
            if(response.data.data.is_open){
              this.yunzhanghu.show = true

                axios.get('/api/plan-market/yunzhifu/getApiToken').then((response)=>{
                  if (response.data.msg.code == 0) {
                    this.yunzhanghulist = response.data.data
                  } else {
                    this.$message.error(response.data.msg.info);
                  }
                })


            }
          } else {
            this.$message.error(response.data.msg.info);
          }
        })

      //获取工猫相关
      axios.get('/api/plan-market/pay/open')
        .then(response => {
          if (response.data.msg.code == 0) {
            this.gongmao.show = response.data.data.gm_open
            if(this.gongmao.show){
              axios.get('/api/plan-market/gongmao/balance')
                .then(response2 => {
                  if (response2.data.msg.code == 0) {
                    this.gongmao.yue = response2.data.data.total_balance
                  } else {
                    this.$message.error(response2.data.msg.info);
                  }
                })
            }
          } else {
            this.$message.error(response.data.msg.info);
          }
        })
      //获取全部分销商
      axios.get('/api/gth/partner/list?page_size=2000')
        .then(response => {
          if (response.data.msg.code == 0) {
            this.fenxiaoshanglists = response.data.data.data
          } else {
            this.$message.error(response.data.msg.info);
          }
        })
      //获取客户经理
      axios.get('/api/plan-market/user/userManagerList')
        .then(response => {
          if (response.data.msg.code == 0) {
             this.kehujinglilists = response.data.data
          } else {
             this.$message.error(response.data.msg.info);
          }
      })
      // axios.get('/api/plan-market/expend/shopConfigInfo')
      //   .then(response => {
      //     if (response.data.msg.code == 0) {
      //       this.peizhi = response.data.data

      //     } else {
      //       this.$message.error(response.data.msg.info);
      //     }
      // })
    },
    mounted() {
      document.addEventListener('paste', this.getClipboardFiles)
    },
    methods: {

      tianjiajietu:function(){
        if(this.all2.withdraw_pics.length >=3 ){
          this.$message.error('最多三张打款图');
        }else{
          this.all2.withdraw_pics.push('')
        }

      },

      huoquyue:function(item){
        this.dealer_id = item.dealer_id
        axios.get('/api/plan-market/yunzhifu/findAccount?dealer_id='+item.dealer_id)
          .then(response2 => {
            if (response2.data.msg.code == 0) {
              this.yunzhanghu.yue = response2.data.data.total_balance
            } else {
              this.yunzhanghu.yue = 0
              this.$message.error(response2.data.msg.info);
            }
          })
      },
      daochu2:function(){
        axios.post('/api/plan-market/invoice/zip/pack',this.all)
          .then(response => {
            if (response.data.msg.code == 0) {
              window.location.href = response.data.data.url
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },
      daochu:function(){

        axios.get('/api/plan-market/expend/pools/export',{params:this.all})
          .then(response => {
            if (response.data.msg.code == 0) {
              window.location.href = location.origin + '/' + response.data.data
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },
      piaojushow:function(item){
        this.log6fapiao = item
        this.log6 = true
      },

      timeschange2(){
        if(this.times2 && this.times2.length > 0){
          this.all.apply_withdraw_at_start = this.times2[0]
          this.all.apply_withdraw_at_end = this.times2[1]
        }else{
          this.all.apply_withdraw_at_start = ''
          this.all.apply_withdraw_at_end = ''
        }
      },
      timeschange(){
        if(this.times && this.times.length > 0){
          this.all.withdraw_at_start = this.times[0]
          this.all.withdraw_at_end = this.times[1]
        }else{
          this.all.withdraw_at_start = ''
          this.all.withdraw_at_end = ''
        }
      },
      bohui:function(item){
        this.bohuiall.id = item.id
        this.bohuilog = true
      },
      bohuigo:function(){
        axios.post('/api/plan-market/withdraw/no',this.bohuiall)
          .then(response => {
            if (response.data.msg.code == 0) {
              this.$message.success('已驳回！')
              this.bohuilog = false
              this.getlist()
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },
      //传图相关====================
      getClipboardFiles (event) {
         let items = event.clipboardData && event.clipboardData.items;
         let file = null
        if(this.log2 == true ){
            if (items && items.length) {
              // 检索剪切板items
              for (var i = 0; i < items.length; i++) {
                if (items[i].type.indexOf('image') !== -1) {
                  file = items[i].getAsFile()
                }
              }
            }
            if (!file) {
              this.$message.error('粘贴内容不是图片')
              return;
            }
            this.uploadok(file)
         }
      },
      uploadok: function(file) {

        var formData = new FormData();
        formData.append("pic", file);
        axios.post('/api/plan-market/order-page/upload-pic3', formData)
          .then(response => {
            if (response.data.msg.code == 0) {
              this.$set(this.all2.withdraw_pics,this.dangqian,response.data.data)
              // this.all2.withdraw_pics[this.dangqian] = response.data.data

            } else {
              this.$message.error(response.data.msg.info);
            }
          })


      },
      //=============================================================
      quedingdakuan:function(){

        if(this.collect_type == 1){
          let obj = {
            id:this.all2.id,
            withdraw_pic:this.all2.withdraw_pic,
            withdraw_pics:this.all2.withdraw_pics,
            withdraw_remark:this.all2.withdraw_remark
          }
          axios.post('/api/plan-market/withdraw/do',obj).then((response)=>{
          	if (response.data.msg.code == 0) {
              this.$message.success('确认打款操作成功');
              this.getlist()
              this.log2 = false
          	} else {
          		this.$message.error(response.data.msg.info);
          	}
          })
        }

        if(this.collect_type == 3){
          let obj = {
            id:this.all2.id,
            pay_way:3,
            withdraw_pic:this.all2.withdraw_pic,
            withdraw_pics:this.all2.withdraw_pics,
            withdraw_remark:this.all2.withdraw_remark
          }
          axios.post('/api/plan-market/withdraw/payment',obj).then((response)=>{
          	if (response.data.msg.code == 0) {
              this.$message.success('确认打款操作成功');
              this.getlist()
              this.log2 = false
          	} else {
          		this.$message.error(response.data.msg.info);
          	}
          })
        }

        if(this.collect_type == 4){
          let obj = {
            id:this.all2.id,
            pay_way:4,
            withdraw_pic:this.all2.withdraw_pic,
            withdraw_pics:this.all2.withdraw_pics,
            withdraw_remark:this.all2.withdraw_remark
          }
          axios.post('/api/plan-market/withdraw/payment',obj).then((response)=>{
          	if (response.data.msg.code == 0) {
              this.$message.success('确认打款操作成功');
              this.getlist()
              this.log2 = false
          	} else {
          		this.$message.error(response.data.msg.info);
          	}
          })
        }

        if(this.collect_type == 5){
          let obj = {
            id:this.all2.id,
            pay_way:5,
            withdraw_pic:this.all2.withdraw_pic,
            withdraw_pics:this.all2.withdraw_pics,
            withdraw_remark:this.all2.withdraw_remark,
            dealer_id:this.dealer_id
          }
          axios.post('/api/plan-market/withdraw/payment',obj).then((response)=>{
          	if (response.data.msg.code == 0) {
              this.$message.success('确认打款操作成功');
              this.getlist()
              this.log2 = false
          	} else {
          		this.$message.error(response.data.msg.info);
          	}
          })
        }


      },
      luru:function(item,type){
        this.lurutype = type
        this.all2 = JSON.parse(JSON.stringify(item))
        if(type != 2){
          this.all2.withdraw_pics = ['']
        }

        this.tixianren = `提现人${this.all2.merchant_name}`
        this.log2 = true
      },

      search: function(val) {
        if(val){
          this.all.status = val
          this.times = []
          this.times2 = []
          this.timeschange()
          this.timeschange2()
        }
        this.all.page = 1
        this.getlist()
      },
      //翻页
      fanye: function(page) {
        this.loading = true
        this.all.page = page
        this.getlist()
      },
      //获取列表
      getlist: function() {
        axios.get('/api/plan-market/expend/pools',{params:this.all})
          .then(response => {
            if (response.data.msg.code == 0) {
              this.list = response.data.data.data
              this.list.forEach(item=>{

                item.zuizhongjine = item.final_commission - item.tax_amount
              })
              this.total = response.data.data.total
              this.loading = false
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },


      handleSelectionChange(val) {
        this.multipleSelection = val;
      }

    }
  }
</script>

<style lang="scss" scoped>
  .yongjinzhichu {
    .tuact{ border: 2px #2974FF solid !important;}
    .actss{ color: rgb(21, 77, 255) !important; border:1px rgb(21, 77, 255) solid !important;}
    .dkfs{border-radius: 3px; background: rgb(239, 239, 239); font-size: 14px; color: rgb(73, 73, 73); width: 127px; text-align: center; line-height: 33px; margin-right: 20px; cursor: pointer;}
    .dkfsact{ background: rgb(21, 77, 255) !important; color: rgb(255, 255, 255) !important;}
    .lia{ padding: 10px 0; margin: 0 15px; border-bottom: 3px rgb(255, 255, 255) solid; cursor: pointer; color: rgb(51, 51, 51);}
    .acts{ border-bottom: 3px #2974FF solid;}
    .powertop {
    	display: flex;
    	background:#f9f9f9;
    }
    .powertopli {
    	flex-basis: 180px;
    	line-height: 50px;
    	border-bottom: 3px #F9F9F9 solid;
    	color: #727272;
    	border-right: 1px #F9F9F9 solid;
    	font-size: 16px;
    	text-align: center;
    }
    .router-link-active {
    	background: #FFFFFF;
    	border-bottom: 3px #2974FF solid;
    }
    /deep/ .el-pagination.is-background .btn-prev:disabled{ background: rgba(246, 246, 246, 0.3); border: 1px rgba(167, 167, 167, 0.3) solid;}
    /deep/ .el-pagination.is-background .btn-next:disabled{ background: rgba(246, 246, 246, 0.3); border: 1px rgba(167, 167, 167, 0.3) solid;}
    /deep/ .el-pagination.is-background .btn-next{ background: rgba(246, 246, 246,1); border: 1px rgba(167, 167, 167,1) solid;}
    /deep/ .el-pagination.is-background .btn-prev{ background: rgba(246, 246, 246,1); border: 1px rgba(167, 167, 167,1) solid;}
    /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active{ background-color: #2974FF;}
    /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active:hover {
        color: #fff;
    }
    /deep/ .el-pagination.is-background .el-pager li:not(.disabled):hover {
        color: #2974FF;
    }
    /deep/ .el-pager li{ border-radius: 14px; background: rgba(255, 255, 255, 1); border: 1px rgba(167, 167, 167, 0.3) solid;}
    /deep/ .btn-prev{ border-radius: 14px; padding: 0 10px;}
    /deep/ .btn-next{ border-radius: 14px; padding: 0 10px;}

    /deep/ .el-table th{ background: rgb(246, 246, 246);}
    /deep/ .el-input__inner{ line-height: 36px; height: 36px; font-size: 12px; background: rgb(247, 248, 250);  border: 0;}
    /deep/ .el-date-editor .el-range-input{ background: rgb(247, 248, 250); }
    /deep/ .el-button{ padding: 11px 23px !important;}
    /deep/ .el-button--mini{ padding: 6px 15px !important;}
    /deep/ .el-button--danger {
        color: #FFF;
        background-color: #2974FF;
        border-color: #2974FF;
    }
    .team {
    	background: #F9F9F9;
    }
  }
</style>
